<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Simpleframe 2.0.0</title>
<jsp:include page="../include/main_meta.jsp"></jsp:include>
<style>
	#wrap {
		height: 500px;
		width: auto;
	}
	#wrap div {
		
	}
	.vsplitbar {
		width: 5px;
		background: #eee;
	}
</style>
<script>
     $(document).ready(function() {
         initLayout();
         $(window).resize(function(){
             initLayout();
         });
     });
     $(function(){
		menuTarget("main!desktop.shtml");
	 });
     function initLayout() {
         var h = document.documentElement.clientHeight -$("#header").height()-5;
         $('#wrap').height(h);
         
         $("#panel").find("iframe").each(function(){
         	//alert("asdfsd");
    		var height = $("#wrap").height();
	     	$(this).height(height+"px"); 
  		});
     }

	
	//splitter
	$().ready(function(){
	   	$("#wrap").splitter({
			type: "v",
			outline: true,
			sizeLeft: 200,
			resizeToWidth: true,
			accessKey: 'I'
		});
	});
	$.ajaxSetup ({
	    cache: false //关闭AJAX相应的缓存
	});
	var pageFrames = []
	function menuTarget(url){
		pageFrames = [];//清空
		//$("#panel").load(url,function(response,status,xhr){
			//alert(status);
		//});
		pageFrames.push(url);
		$("#panel").html('<iframe id="'+url+'" src="'+url+'" frameborder="0" scrolling="no" width="100%"></iframe>');
		autoWidthFrame(url);
	}
	function mainTarget(url){
		//$("script").each(function(){
    	//	alert($(this).attr("src"))
  		//});
		pageFrames.push(url);
		//$("#panel").load(url,function(response,status,xhr){
		//	//alert(status);
		//});
		displayframe(url,url);
	}
	function displayframe(id,url){
		$("#panel").find("iframe").each(function(){
    		$(this).css("display","none");
  		});
		var cru = document.getElementById(id);
		if(cru!=null){
			$(cru).css("display","block");
		}else{
			$("#panel").append('<iframe id="'+url+'" src="'+url+'" frameborder="0" scrolling="no" width="100%"></iframe>');
			autoWidthFrame(url);
		}
	}
	function autoWidthFrame(url){
		var height = $("#wrap").height();
	    var cru = document.getElementById(url);
	    $(cru).height(height-2+"px");
	}
	function mainBack(){
		//alert(pageFrames.length); 
		//$("#panel").html(pageFrames[pageFrames.length-1]);
		if(pageFrames.length>=2){
			var id = pageFrames[pageFrames.length-2];
			var did = pageFrames[pageFrames.length-1]
			
			displayframe(id,id);
			pageFrames.splice(pageFrames.length-1,1);
			
			var cru = document.getElementById(did);
			$(cru).remove();
		}else{
			
			alert("没有返回了...");
		}
		
		
	}
 	//function mainTarget(url){
	//	$("#panel").children().each(function(){   
	//		alert($(this).html());   
	//	}); 
	//} 
</script>


</head>
<body>
<jsp:include page="header.jsp"></jsp:include>
<div id="wrap">
    <div class="column" >
        <div class="panel">
            <div class="panel_header">
                <div class="panel_ctrl_icon icon_expand"></div>
                    <div class="icon icon_page"></div>
                    功能列表
            </div>
            <div class="panel_body">
                <jsp:include page="menu.jsp"></jsp:include>
            </div>
        </div>
    </div>
    <div class="column">
        <div class="panel" id="panel">
            
        </div>
    </div>
    <div style="clear:both"></div>
</div>
</body>
</html>